<template>
  <div class="chart pie">
    <div class="chart-container" ref="pieChart"></div>
  </div>
</template>

<script>
export default {
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
      const myChart = this.$echarts.init(this.$refs["pieChart"]);
      const option = {
        title: {
          text: "Pie Chart",
          subtext: "subTitle",
          left: "center",
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          orient: "vertical", // 图例布局方向
          left: "left",
        },
        series: [
          {
            name: "Pie Chart",
            type: "pie",
            // radius: ["40%", "70%"],
            // radius: "50%",
            data: [
              { value: 1048, name: "data1" },
              { value: 735, name: "data2" },
              { value: 580, name: "data3" },
              { value: 484, name: "datta4" },
              { value: 300, name: "data5" },
            ],
            label: {
              show: true,
              // position: "inside",
            },
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
          },
        ],
      };
      myChart.setOption(option);
    },
  },
};
</script>

<style></style>
